package com.zzyl.service.impl;

import com.zzyl.entity.Bed;
import com.zzyl.mapper.BedMapper;
import com.zzyl.service.BedService;
import com.zzyl.vo.BedVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BedServiceImpl implements BedService {

    @Autowired
    private BedMapper bedMapper;

    @Override
    public List<BedVo> getBedsByRoomId(Long roomId) {
        return bedMapper.getBedsByRoomId(roomId);
    }

    @Override
    public void create(Bed bed) {
        bed.setBedStatus(0);
        bedMapper.insert(bed);
    }

    @Override
    public BedVo readBedById(Long id) {
        BedVo bedVo = bedMapper.selectById(id);
        return bedVo;
    }

    @Override
    public void update(Bed bed) {
        bedMapper.update(bed);
    }

    @Override
    public void delete(Long id) {
        bedMapper.delete(id);
    }

}

